using System;

namespace Slaks.VectorBasics
{
	public class VectorItem : IComparable
	{
		private long m_id;
		private double m_frequency;

		public VectorItem(long id)
		{
			m_id = id;
			m_frequency = 0;
		}

		public VectorItem(long id, long frequency)
		{
			m_id = id;
			m_frequency = frequency;
		}

		public long GetId()
		{
			return m_id;
		}


		public double Frequency
		{
			get { return m_frequency; }
			set { m_frequency = value; }
		}

		public override bool Equals(object obj)
		{
			if (obj is VectorItem)
				if (this.CompareTo((VectorItem) obj) == 0) return true;
			return false;
		}

		#region IComparable Members

		public int CompareTo(VectorItem obj)
		{
			if (this.m_id < obj.m_id) return -1;
			else if (this.m_id == obj.m_id) return 0;
			return 1;
		}

		public int CompareTo(object obj)
		{
			VectorItem vertex = obj as VectorItem;
			if (vertex == null) throw new ArgumentException("Object passed for comparison is not VectorItem");
			return this.CompareTo(vertex);
		}

		#endregion
	}
}